import request from '@/request/request.js';

// 登录
export const postLogin = (data) => {
  return request({
    url: '/app/login/organization',
    method: 'post',
    data
  })
}

// 微信登录
export const winxinLogin = (data) => {
  return request({
    url: '/app/wx/login/organization',
    method: 'post',
    data
  })
}

// 退出登录
export const getLogOut = (data) => {
  return request({
    url: '/logout',
    method: 'post',
    data
  })
}

// 用户信息
export const getUser = () => {
  return request({
    url: '/getInfo',
    method: 'get'
  }, false)
}

// 注册
export const postRegister = (data) => {
  return request({
    url: '/register',
    method: 'post',
    data
  })
}

// 用户(机构)类型
export const getUserType = (data) => {
  return request({
    url: '/system/user/listByUserType',
    method: 'get',
    data
  })
}

// 获取短信 绑定BIND_USER, 编辑EDIT_MOBILE, 登录LOGIN, 注册REGISTER, 修改密码UPDATE_PASSWORD
export const getSmsCode = (verificationEnums, phoneNumber) => {
  return request({
    url: `/org/app/sms/${verificationEnums}/${phoneNumber}`,
    method: 'get',
  })
}

// 校验验证码
export const getValidateCode = (data) => {
  return request({
    url: '/org/app/sms/validateCode',
    method: 'post',
    data
  })
}

// 修改密码
export const postUpdatePwd = (data) => {
  return request({
    url: '/system/user/profile/appUpdatePwd',
    method: 'put',
    data
  })
}

// 绑定账号
export const postBindAccount = (data) => {
  return request({
    url: '/wx/bind',
    method: 'post',
    data
  })
}